package cn.sczc.jh.client;

import java.io.File;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SuppressWarnings("deprecation")
@EnableFeignClients
@SpringBootApplication
@EnableJms
@MapperScan(value = "cn.sczc.jh.client.mapper")
public class JhClientWebApplication extends WebMvcConfigurerAdapter{

	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		ApplicationHome home = new ApplicationHome(getClass());
	    File jarFile = home.getSource();
	    String uploadPath = jarFile.getParentFile().toString()+ File.separator + "uploads"
				+ File.separator;
		registry.addResourceHandler("/uploads/**").addResourceLocations("file:"+uploadPath);
	}

	public static void main(String[] args) {
		SpringApplication.run(JhClientWebApplication.class, args);
	}

}
